﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace NJL.Web.Controls
{
    public partial class WUCIndexShare : BaseUserControl
    {
        private readonly BLL.NJL_ACTIVE bllService = new BLL.NJL_ACTIVE();
        private readonly BLL.NJL_NEWS bllNews = new BLL.NJL_NEWS();
        private readonly BLL.NJL_COMPANY bllCompany = new BLL.NJL_COMPANY();
        protected readonly BLL.NJL_BOOK bllBook = new BLL.NJL_BOOK();

        protected IList<Model.NJL_NEWS> LIST_NEWS;
        protected IList<Model.NJL_ACTIVE> LIST_SERVICE;
        protected List<Model.NJL_ACTIVE> LIST_Company = new List<Model.NJL_ACTIVE>();

        protected List<Model.NJL_COMPANY> LIST_COMPANY;
        protected List<Model.NJL_BOOK> LIST_BOOK;
        
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadData();
        }

        private void LoadData()
        {
            LIST_NEWS = bllNews.GetModelList(7, " NJL_SYS_BASE_ID='" + WEBSITE_CODE + "' ", "ID desc");
            LIST_SERVICE = bllService.GetModelList(8, " NJL_COMPANY_ID IN (SELECT ID FROM NJL_COMPANY WHERE NJL_SYS_BASE_ID='" + WEBSITE_CODE + "' and IS_PUBLISH=1)", "SORT DESC,ID desc ");
            //if (WEBSITE_FOCUS_CITY_CODE != "")
            //{
            //    LIST_SERVICE = bllService.GetModelList(8, " NJL_COMPANY_ID IN (SELECT ID FROM NJL_COMPANY WHERE NJL_SYS_BASE_ID='" + WEBSITE_CODE + "' AND AREA_CODE='" + WEBSITE_FOCUS_CITY_CODE + "' and IS_PUBLISH=1)", " ID desc ");
            //}
            //else
            //{
            //    LIST_SERVICE = bllService.GetModelList(8, " NJL_COMPANY_ID IN (SELECT ID FROM NJL_COMPANY WHERE NJL_SYS_BASE_ID='" + WEBSITE_CODE + "' and IS_PUBLISH=1)", " ID desc ");
            //}
            LIST_COMPANY = bllCompany.GetModelList(6, "NJL_COMPANY.NJL_SYS_BASE_ID='"+WEBSITE_CODE+"' AND NJL_COMPANY.AUDIT_STATE=1 AND NJL_COMPANY.IS_OPEN_BOOK=1 ", "NJL_COMPANY.SORT DESC");
        }

        protected Model.NJL_USER GetUserByID(string UserID)
        {
            return new BLL.NJL_USER().GetModel(UserID);
        }

    }
}